
public class Person {

	private String nume;
	private String prenume;
	private int varsta;
   
	public Person(String nume, String prenume, int varsta) {
        this.nume = nume;
        this.prenume = prenume;
        this.varsta = varsta;
    }
    
    
   
    @Override
    public boolean equals(Object o) {
 
        // Check if the object is compared with itself
        if (o == this) {
            return true;
        }
 
        // Check if the object is an instance of Person class
        if (!(o instanceof Person)) {
            return false;
        }
         
        // Typecast o to Person so that we can compare data members 
        Person c = (Person) o;
         
        // Compare the data members and return true if they are equal
        return nume == c.nume
                && prenume == c.prenume
        			&& varsta == c.varsta;
    }
    
}
